/* 移动端登录页面优化样式 */

@media (max-width: 768px) {
    .login-page {
        padding: 10px;
    }
    
    .login-container {
        max-width: 100%;
        padding: 0;
    }
    
    .login-card {
        border-radius: 15px;
        margin: 10px 0;
    }
    
    .login-header {
        padding: 25px 20px 20px;
    }
    
    .system-logo {
        width: 60px;
        height: 60px;
        font-size: 2rem;
        margin-bottom: 15px;
    }
    
    .system-title {
        font-size: 1.4rem;
        margin-bottom: 5px;
    }
    
    .system-subtitle {
        font-size: 0.9rem;
    }
    
    .login-form {
        padding: 25px 20px;
    }
    
    .form-group {
        margin-bottom: 20px;
    }
    
    .form-control {
        padding: 12px 45px 12px 15px;
        font-size: 16px; /* 防止iOS缩放 */
        border-radius: 10px;
    }
    
    .input-icon {
        right: 12px;
        font-size: 1rem;
    }
    
    .login-btn {
        padding: 14px;
        font-size: 1rem;
        border-radius: 10px;
    }
    
    .remember-me {
        margin-bottom: 15px;
    }
    
    .remember-me label {
        font-size: 0.85rem;
    }
    
    .login-footer {
        padding: 15px;
        font-size: 0.8rem;
    }
    
    /* 粒子效果在移动端减少 */
    .particle:nth-child(n+5) {
        display: none;
    }
}

@media (max-width: 480px) {
    .login-card {
        border-radius: 12px;
        margin: 5px 0;
    }
    
    .login-header {
        padding: 20px 15px 15px;
    }
    
    .system-logo {
        width: 50px;
        height: 50px;
        font-size: 1.8rem;
        margin-bottom: 12px;
    }
    
    .system-title {
        font-size: 1.2rem;
    }
    
    .system-subtitle {
        font-size: 0.8rem;
    }
    
    .login-form {
        padding: 20px 15px;
    }
    
    .form-control {
        padding: 10px 40px 10px 12px;
        font-size: 16px;
    }
    
    .input-icon {
        right: 10px;
        font-size: 0.9rem;
    }
    
    .login-btn {
        padding: 12px;
        font-size: 0.95rem;
    }
    
    .alert {
        padding: 10px;
        font-size: 0.85rem;
    }
    
    /* 进一步减少粒子 */
    .particle:nth-child(n+3) {
        display: none;
    }
}

/* 横屏模式优化 */
@media (max-height: 600px) and (orientation: landscape) {
    .login-page {
        align-items: flex-start;
        padding-top: 20px;
    }
    
    .login-header {
        padding: 20px 30px 15px;
    }
    
    .system-logo {
        width: 50px;
        height: 50px;
        font-size: 1.8rem;
        margin-bottom: 10px;
    }
    
    .system-title {
        font-size: 1.3rem;
        margin-bottom: 5px;
    }
    
    .system-subtitle {
        font-size: 0.85rem;
    }
    
    .login-form {
        padding: 25px 30px;
    }
    
    .form-group {
        margin-bottom: 15px;
    }
    
    .login-footer {
        padding: 10px;
    }
    
    /* 隐藏粒子效果以提高性能 */
    .particles {
        display: none;
    }
}

/* 触摸设备优化 */
@media (hover: none) and (pointer: coarse) {
    .form-control:focus {
        transform: none; /* 移除变换效果，避免键盘弹出时的问题 */
    }
    
    .login-btn:hover {
        transform: none;
        box-shadow: 0 5px 15px rgba(102, 126, 234, 0.3);
    }
    
    .login-btn:active {
        transform: scale(0.98);
    }
    
    /* 增大触摸目标 */
    .remember-me input[type="checkbox"] {
        width: 18px;
        height: 18px;
        margin-right: 10px;
    }
    
    .password-toggle {
        padding: 8px;
        min-width: 40px;
        min-height: 40px;
    }
}

/* 高DPI屏幕优化 */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .system-logo {
        border: 1px solid rgba(255, 255, 255, 0.1);
    }
    
    .login-card {
        border: 0.5px solid rgba(255, 255, 255, 0.3);
    }
}

/* 暗色模式移动端优化 */
@media (prefers-color-scheme: dark) and (max-width: 768px) {
    .login-card {
        background: rgba(20, 20, 20, 0.95);
        border: 1px solid rgba(255, 255, 255, 0.1);
    }
    
    .form-control {
        background: rgba(255, 255, 255, 0.05);
        border-color: rgba(255, 255, 255, 0.15);
        color: #f8f9fa;
    }
    
    .form-control::placeholder {
        color: rgba(255, 255, 255, 0.4);
    }
}

/* 无障碍优化 */
@media (prefers-reduced-motion: reduce) {
    .particle {
        animation: none;
        opacity: 0.1;
    }
    
    .login-card {
        animation: none;
    }
    
    .form-control:focus {
        transition: none;
    }
    
    .login-btn {
        transition: none;
    }
}

/* 高对比度模式移动端优化 */
@media (prefers-contrast: high) and (max-width: 768px) {
    .login-card {
        border: 2px solid #000;
        background: #fff;
    }
    
    .login-header {
        background: #000;
        color: #fff;
    }
    
    .form-control {
        border: 2px solid #000;
        background: #fff;
        color: #000;
    }
    
    .form-control:focus {
        border-color: #0066cc;
        box-shadow: 0 0 0 2px #0066cc;
    }
    
    .login-btn {
        background: #000;
        color: #fff;
        border: 2px solid #000;
    }
}

/* 键盘导航优化 */
.form-control:focus-visible,
.login-btn:focus-visible,
.remember-me input:focus-visible,
.password-toggle:focus-visible {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

/* 屏幕阅读器专用样式 */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* 错误状态移动端优化 */
@media (max-width: 768px) {
    .alert {
        border-radius: 8px;
        margin-bottom: 15px;
        padding: 12px;
        font-size: 0.9rem;
    }
    
    .form-control.is-invalid {
        border-color: #dc3545;
        box-shadow: 0 0 0 0.15rem rgba(220, 53, 69, 0.25);
    }
    
    .form-control.is-valid {
        border-color: #28a745;
        box-shadow: 0 0 0 0.15rem rgba(40, 167, 69, 0.25);
    }
}

/* 加载状态移动端优化 */
@media (max-width: 768px) {
    .loading {
        width: 16px;
        height: 16px;
        border-width: 2px;
        margin-right: 8px;
    }
}

/* 网络状态提示移动端优化 */
@media (max-width: 768px) {
    .network-status {
        position: fixed;
        top: 10px;
        left: 10px;
        right: 10px;
        z-index: 10000;
        border-radius: 8px;
        padding: 10px;
        font-size: 0.85rem;
        text-align: center;
    }
}